Repository navigation
Conversation
`adapt usage list` and `adapt usage summary` cover GET /v1/usage and GET /v1/usage/summary for sandbox runs and model calls. Lists reuse the shared cursor pagination, so --all exports every page as one JSON document. Tables show one row per run or call, and per member with a total row for summaries; JSON passes through unchanged. Days are limited to the 7, 30, and 90 day windows Platform supports, so ranges cannot be invalid or reversed. Platform enforces permissions and rejects --sandbox for model usage. Help and docs say this is metered usage, not an audit log, and that model token totals include calls made with the organization's own provider keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CPU and memory totals under 0.01 hours rounded to 0.00 CPU-h or GiB-h, which read as no usage even though usage was measured. On a staging organization, most short sandbox runs showed zero. Totals under 36 seconds now show in resource-seconds, such as 19.5 CPU-s, in both `usage` and `sandbox usage`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Confidence Score: 4/5
Summary
Adds read-only usage listing, summaries, and resource-time formatting; both earlier findings are resolved. Formatting, Clippy, 133 tests, and focused mock-terminal checks passed locally; no remaining actionable issues found, but live API behavior was not tested.
Deployed verification not applicable: adapt/platform-cli is outside the adapt/adapt and adapt/platform pilot. Its CI builds CLI artifacts but configures no PR preview. No webhook was sent.
Important Files Changed
| File | Changes |
|---|---|
| src/cli.rs | Usage subcommands, validated windows, member filters, and corrected historical sandbox selector help. |
| src/commands.rs | Usage requests, terminal tables, aggregated estimate notes, and shared resource-time formatting. |
| src/output.rs | Shared pagination hint for terminal tables. |
| tests/usage/mod.rs | Filters, summary defaults, pagination, JSON provenance, help semantics, and invalid arguments. |
| tests/cli.rs | Registers the usage integration tests. |
| docs/cli-reference.md | Documents metering semantics, estimate notes, historical sandbox filtering, and output units. |
| docs/api-coverage.md | Maps usage endpoints to CLI commands and Platform revisions. |
| skills/adapt/SKILL.md | Adds metered-usage discovery and command examples. |
Run info
| Field | ID |
|---|---|
| Agent | 0d6ccd7e-b62f-4075-a561-199d1a7b1bf0 |
| Automation | ec14e69d-634f-4af0-a6dd-27aa06a1f6b3 |
| Run | 3673c3b5-e701-4689-af8c-c700af14ea5b |
Reviewed: 9f5e86c-b6ef411 · ↻ Re-run review
Sandbox usage lists now note intervals that Platform estimated from allocated resources across the displayed records, as summaries and `sandbox usage` already do. JSON output is unchanged. Platform returns full sandbox UUIDs without a lookup, so they filter the history of deleted sandboxes; only ID prefixes need a sandbox that hasn't been deleted. Help and docs now say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves conflicts with the model catalog commands (#32) by keeping both sides: the usage and model command definitions, both reference sections, and both platform provenance notes in the API coverage doc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #14.
Summary
Adds two commands for Platform's metered usage, covering both sandbox runs and model calls:
usage listcallsGET /v1/usage. Without--daysit returns all history.--alluses the shared cursor pagination to export every page as one JSON document.usage summarycallsGET /v1/usage/summaryand defaults to 30 days.—, never0.--jsonprint the API response unchanged.19.5 CPU-s) instead of rounding to0.00. This also applies tosandbox usage.Scope notes (as reviewed on #14)
--daysagainst those values. Ranges can't be invalid or reversed, and custom dates would need a backend change.--user. Platform also rejects--sandboxfor model usage. A full UUID finds the history of a deleted sandbox; an ID prefix needs a sandbox that hasn't been deleted.details.credentialSourcecan separate those calls.Testing
cargo fmt --check,cargo clippy -D warningsandcargo testpass.tests/usage/mod.rs): filters sent unchanged, summary defaults,--allacross pages with filters kept, empty results, and invalid options rejected before any request.--limit 5 --all(3 pages, same 14 runs, no duplicates), the model kind with no calls, summaries for both kinds,--user, the server's error for--sandboxwith--kind model, and--sandboxfor a deleted sandbox (its full UUID returned its run; its prefix returned a 404, as documented). The list's estimate note counted the same 7 intervals as the summary.Docs
docs/cli-reference.md: a new "Metered usage" section, plus the command table and list examples.docs/api-coverage.md: the two routes and the platform commits they come from.skills/adapt/SKILL.md: examples, and usage added to the skill description.🤖 Generated with Claude Code